package com.woniu.cq.medical.controller;


import com.woniu.cq.medical.common.Result;
import com.woniu.cq.medical.controller.form.PrescriptionInfoForm;
import com.woniu.cq.medical.controller.form.ProjectForm;
import com.woniu.cq.medical.controller.form.RegisterAllForm;
import com.woniu.cq.medical.service.PrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2020-09-08
 */
@RestController
@RequestMapping("/medical/prescription")
public class PrescriptionController {

    @Autowired
    private PrescriptionService prescriptionService;

    @PostMapping("selectProduct")
    public Result selectProduct(String patientIdCard){
        List<PrescriptionInfoForm> prescriptionInfoForm = prescriptionService.selectProduct(patientIdCard);
        return Result.success(prescriptionInfoForm);
    }

    @PostMapping("selectProject")
    public Result selectProject(String patientIdCard){
        List<ProjectForm> ProjectForm = prescriptionService.selectProject(patientIdCard);
        return Result.success(ProjectForm);
    }

    @PostMapping("selectProductAll")
    public Result selectProductAll(String patientIdCard){
        List<PrescriptionInfoForm> prescriptionInfoForm = prescriptionService.selectProductAll(patientIdCard);
        return Result.success(prescriptionInfoForm);
    }

    @PostMapping("selectProjectAll")
    public Result selectProjectAll(String patientIdCard){
        List<ProjectForm> ProjectForm = prescriptionService.selectProjectAll(patientIdCard);
        return Result.success(ProjectForm);
    }

    /**
     * 挂号收费记录
     * @param patientIdCard
     * @return
     */
    @PostMapping("selectRegister")
    public Result selectRegister(String patientIdCard){
        List<RegisterAllForm> registerAllForm=prescriptionService.selectRegister(patientIdCard);
        return Result.success(registerAllForm);
    }
}

